using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public partial class FuncGroup
{
    protected GameObject UIObj;

    private FuncPage m_CurrentPage;

    private ExitPage m_ExitPage;
    private VolumPage m_VolumPage;
    private ArchivePage m_ReadArchivePage;
    private ArchivePage m_SaveArchivePage;

    public FuncGroup()
    {
        m_ExitPage = new ExitPage();
        m_VolumPage = new VolumPage();
        m_SaveArchivePage = new ArchivePage(false);
        m_ReadArchivePage = new ArchivePage(true);
    }

    public void Bind(GameObject obj)
    {
        UIObj = obj;

        InitializedObj();

        Init();
    }

    private void Init()
    {
        m_ExitPage.Bind(m_ExitPageGameObject, this, UIObj.transform as RectTransform);
        m_VolumPage.Bind(m_VolumPageGameObject, this, UIObj.transform as RectTransform);
        m_ReadArchivePage.Bind(m_ReadArchivePageGameObject, this, UIObj.transform as RectTransform);
        m_SaveArchivePage.Bind(m_SaveArchivePageGameObject, this, UIObj.transform as RectTransform);

        ChagePage(m_SaveArchivePage);
    }

    public void ChagePage(FuncPage newPage)
    {
        m_CurrentPage?.OnDisable();
        m_CurrentPage = newPage;
        m_CurrentPage?.OnEnable();
    }
}
